/* Reset + base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background: #f9fafb;
  color: #333;
  line-height: 1.6;
  padding: 2rem;
  transition: background 0.3s, color 0.3s;
}

.container {
  max-width: 400px;
  margin: auto;
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: background 0.3s;
}

.title {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: inherit;
}

/* Theme toggle */
.theme-toggle {
  margin-bottom: 1rem;
}

.theme-toggle input {
  display: none;
}

.switch {
  cursor: pointer;
  font-size: 1.4rem;
  background: #e5e7eb;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  transition: background 0.3s;
}
.switch:hover {
  background: #d1d5db;
}

/* Calculator */
.calculator {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.display {
  background: #111827;
  color: #fff;
  padding: 1rem;
  border-radius: 8px;
  font-size: 1.5rem;
  text-align: right;
  overflow-x: auto;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}

button {
  padding: 1rem;
  font-size: 1.2rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: #e5e7eb;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

button:hover {
  background: #d1d5db;
}

button:active {
  transform: scale(0.95);
}

button.zero {
  grid-column: span 2;
}

/* Footer credit */
.credit {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.credit a {
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.3s ease;
}

.credit a:hover {
  color: #2563eb;
}

.github-icon {
  fill: currentColor;
}

/* Dark theme using checkbox hack */
#toggle:checked ~ .calculator .display {
  background: #f9fafb;
  color: #111827;
}

#toggle:checked ~ .calculator .buttons button {
  background: #374151;
  color: #fff;
}
#toggle:checked ~ .calculator .buttons button:hover {
  background: #1f2937;
}

#toggle:checked ~ .display {
  background: #f9fafb;
  color: #111827;
}

/* Responsive */
@media (max-width: 500px) {
  .container {
    padding: 1.2rem;
  }
  .title {
    font-size: 1.5rem;
  }
  .display {
    font-size: 1.2rem;
  }
  button {
    font-size: 1rem;
  }
}
